/**
 * 系统管理模块接口列表
 */
import base from "../base"; // 导入接口域名列表
import axios from "@/http/axios"; // 导入http中创建的axios实例
// import { get, post, put } from "@/http/axios"; // 导入http中创建的axios实例
// import qs from "qs"; // 根据需求是否导入qs模块

const accessControl = {
   // 获取所有桥梁列表
   getAppBridgeAll() {
    return axios.get(`${base.baseUrl}/bridge_basic/queryBridgeListByAppKey`);
  },
  // 桥梁管理
  // 桥梁列表 /rz-cloud/pmmodel/site/page/
  // YU 这里有连个 searchSite 方法 ，项目中只用到一个查询searchSite方法，所以注释掉看看！！
  // searchSite(start, length, params) {
  //   return axios.get(`${base.cloudUrl}/pmmodel/site/page/${start}/${length}`, {
  //     params: params
  //   });
  // },
  // 桥梁下拉框 场站集合查询(appkey)
  departmentSiteInfo() {
    return axios.get(`${base.cloudUrl}/permission/api/perm/user/company/useable`, {
      headers: { "app-key": "" }
    });
  },
  // 用户视图
  userView() {
    return axios.get(`${base.cloudUrl}/permission/api/perm/user/view/all`, {
      headers: { "app-key": "" }
    });
  },

  // 查询主体列表 和模糊查询接口
  searchSite(params = {}){
    return axios.get(`${base.accessUrl}/own/queryOwnList`,{params:params});
  },
  //查询项目列表
  queryProType(params = {}) {
    return axios.get(`${base.accessUrl}/own/queryProType`, {params})
  },
  // 获取列表数据
  getSiteList(){
    return axios.get(`${base.accessUrl}/tree/queryCountWithProject`);
  },
  // 桥梁新增
  addSite(params) {
    return axios.post(`${base.accessUrl}/own/addOwnInfo`, params);
  },
  // 桥梁编辑
  updateSite(params) {
    return axios.post(`${base.accessUrl}/own/updateOwnInfo`, params);
  },
  // 桥梁删除
  delSite(params) {
    return axios.get(`${base.accessUrl}/own/deleteOwnInfo`, {
      params: params
    });
  },
  // 资源管理页面
  //选择应用
  resourceApplication() {
    return axios.get(`${base.cloudUrl}/permission/app/get/all`);
  },
  //资源树
  resourceTree() {
    return axios.get(
      `${base.cloudUrl}/permission/resource/app-key/all/node`
    );
  },
  //资源树点击
  resourceTreeItem(id) {
    return axios.get(`${base.cloudUrl}/permission/resource/${id}`);
  },
  //资源详情新增
  resourceInfoAdd(params) {
    return axios.post(`${base.cloudUrl}/permission/resource/`, params);
  },
  //资源详情修改
  resourceInfoEdit(params) {
    return axios.put(`${base.cloudUrl}/permission/resource/`, params);
  },
  //资源详情删除
  resourceInfoDel(id) {
    return axios.delete(`${base.cloudUrl}/permission/resource/${id}`);
  },
  //部门管理页面
  //部门树
  departmentTree() {
    return axios.get(
      `${base.cloudUrl}/permission/dept/tree/app-key/all`
    );
  },
  //查询-表格数据
  departmentFilter(id, params) {
    return axios.get(
      `${base.cloudUrl}/permission/dept/child/page/parent/${id}`,
      { params: params }
    );
  },
  //新增
  departmentAdd(params) {
    return axios.post(`${base.cloudUrl}/permission/dept/`, params);
  },

  //编辑
  departmentEditor(params) {
    return axios.put(` ${base.cloudUrl}/permission/dept/`, params);
  },
  //删除
  departmentDel(id) {
    return axios.delete(`${base.cloudUrl}/permission/dept/${id}`);
  },
  //状态关闭
  closeState(params) {
    return axios.put(`${base.cloudUrl}/permission/dept/close`, params);
  },
  //状态启用
  startState(params) {
    return axios.put(`${base.cloudUrl}/permission/dept/use`, params);
  },

  // ${base.cloudUrl}/permission/dept/
  //角色管理页面
  //角色表格
  rolePaging(params) {
    return axios.get(`${base.cloudUrl}/permission/role/page`, {
      params: params
    });
  },
  //角色新增
  addRole(params) {
    return axios.post(`${base.cloudUrl}/permission/role/`, params);
  },
  //角色编辑
  editRole(params) {
    return axios.put(`${base.cloudUrl}/permission/role/`, params);
  },
  configRole(id) {
    return axios.get(`${base.cloudUrl}/permission/role/${id}`);
  },
  //角色删除
  delRole(id) {
    return axios.delete(`${base.cloudUrl}/permission/role/${id}`);
  },
  //角色树
  roleTree(id) {
    return axios.get(`${base.cloudUrl}/permission/resource/list/tree/${id}`);
  },
  //角色状态-冻结
  // roleStatusFrozen(id) {
  //   return axios.delete(`${base.cloudUrl}/permission/role/freeze/${id}`);
  // },
  //角色状态-启用
  // roleStatusEnable(params) {
  //   return axios.put(`${base.cloudUrl}/permission/role/start`, params);
  // },
  //权限配置
  rolePowerConfirm(params) {
    return axios.put(`${base.cloudUrl}/permission/role/resource`, params);
  },

  //视图管理
  //获取视图列表
  viewsList(params) {
    return axios.get(`${base.cloudUrl}/permission/view/page`, {
      params: params
    });
  },
  // 下面这个方法也多余  YU 注释掉
   //视图-删除
  //  delView(id) {
  //   return axios.delete(`${base.cloudUrl}/permission/view/${id}`);
  // },
   //视图-修改
   editView(params) {
    return axios.put(`${base.cloudUrl}/permission/view/`,params);
  },
  // 这个方法也多一个？？？  YU 注释掉
   //视图-添加
  //  addView(params) {
  //   return axios.post(`${base.cloudUrl}/permission/view`,params);
  // },
   //获取appkey视图
   getView(appkey) {
    return axios.get(`${base.cloudUrl}/permission/api/perm/user/view/all`, {
      headers: { "app-key": appkey }
    });
  },

  //用户管理页面
  //用户-查询
  searchUser(params) {
    return axios.get(`${base.cloudUrl}/permission/user/all/page`, {
      params: params
    });
  },
  //用户-新增
  addUser(params) {
    return axios.post(`${base.cloudUrl}/permission/user/`, params);
  },
  //用户-编辑
  editUser(params) {
    return axios.put(`${base.cloudUrl}/permission/user/`, params);
  },
  //手机号校验
  testPhone(params) {
    return axios.get(`${base.cloudUrl}/permission/user/phone/repetition`, {
      params: params
    });
  },
  //用户名校验
  testUserName(params) {
    return axios.get(`${base.cloudUrl}/permission/user/username/repetition`, {
      params: params
    });
  },

  //用户-删除
  delUser(id) {
    return axios.delete(`${base.cloudUrl}/permission/user/${id}`);
  },
  //用户状态-冻结
  userStatusFrozen(params) {
    return axios.put(`${base.cloudUrl}/permission/user/freeze/`, params);
  },
  //用户状态-启用
  userStatusEnable(params) {
    return axios.put(`${base.cloudUrl}/permission/user/free`, params);
  },
  //用户-设置密码
  userSetPassWord(params) {
    return axios.put(`${base.cloudUrl}/permission/user/password`, params);
  },


  //用户组管理页面
  //用户组-查询
  userGroupTable(params) {
    return axios.get(`${base.cloudUrl}/permission/group/page`, {
      params: params
    });
  },
  //用户组-新增
  userGroupAdd(params) {
    return axios.post(`${base.cloudUrl}/permission/group/`, params);
  },
  //用户组-编辑
  userGroupEditor(params) {
    return axios.post(`${base.cloudUrl}/permission/group/`, params);
  },
  //用户组-删除
  userGroupDel(id) {
    return axios.delete(`${base.cloudUrl}/permission/group/${id}`);
  },
  //用户组-复制
  userGroupClone(params) {
    return axios.put(`${base.cloudUrl}/permission/group/clone`, params);
  },
  //用户组-详细配置
  userGroupConfig(params) {
    return axios.put(`${base.cloudUrl}/permission/group/config`, params);
  },
  //用户组-角色配置
  userGroupRole() {
    return axios.get(`${base.cloudUrl}/permission/role/name/all`);
  },
  //用户组-桥梁配置
  getPlantStation() {
    return axios.get(`${base.cloudUrl}/permission/dept/app-key/all`);
  },
  // 视图配置
  viewConfiguration(params){
    return axios.get(`${base.cloudUrl}/permission/view/page`,{params: params});
  },
  //获取部门下所有人员
  getDeptUser(deptId) {
    return axios.get(`${base.cloudUrl}/permission/user/dept-user/${deptId}`);
  },

  //视图管理
  // 视图查询 /PM.Cloud/permission/view/page
  searchView(params) {
    return axios.get(`${base.cloudUrl}/permission/view/page`, {
      params: params
    });
  },
  // 视图-编辑
  addView(params) {
    return axios.post(`${base.cloudUrl}/permission/view/`, params);
  },
  // 视图-新建
  addViewModify(params) {
    return axios.put(`${base.cloudUrl}/permission/view/`, params);
  },
  // tab-2左侧菜单配置
  initMenu(viewId) {
    return axios.get(`${base.cloudUrl}/permission/view/${viewId}`);
  },
  // 视图-删除
  delView(id) {
    return axios.delete(`${base.cloudUrl}/permission/view/${id}`);
  },
  // 视图-复制
  cloneView(params) {
    return axios.post(`${base.cloudUrl}/permission/view/clone`, params);
  },
  // 视图-配置
  saveViewConfig(params) {
    return axios.put(`${base.cloudUrl}/permission/view/config`, params);
  }
};

export default accessControl;
